package cn.tedu.spring.life;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
public class Life {

    private String meaning;
    public Life(){
        System.out.println("1.无参构造实例化");
    }
    @Value("生命的意义在于运动")
    public void setMeaning(String meaning) {
        System.out.println("2.set方法赋值");
        this.meaning = meaning;
    }
    @PostConstruct
    public void init(){
        System.out.println("3.生命周期初始化");
    }
    @PreDestroy
    public void destroy(){
        System.out.println("5.生命周期销毁");
    }




}
